# -*- coding: utf-8 -*-

from datetime import timedelta

from celery import Celery, platforms
from celery.schedules import crontab

import conf_yunwei
import conf

platforms.C_FORCE_ROOT = True

yunwei_beat = Celery(
    'yunwei_beat_worker',
    broker=conf.MQ_BROKER
)
yunwei_beat.conf.update(
    task_serializer='json',
    accept_content=['json'],
    result_serializer='json',
    timezone='Asia/Shanghai',
    task_create_missing_queues=True,
    # task_time_limit = 60 * 3
    beat_schedule={
        'elk_request_status_scheduling-xx-minnutes':{
            'task': 'elk_request_status_worker.elk_request_status_scheduling',
            'schedule': timedelta(minutes=1),
            'args': [1],
            'options': {'queue': conf.MQ_ELK_REQUEST_STATUS}
        }
    }
)